{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from dorm import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "s=[0]*10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "slots: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]\n",
      "Toby Zeus\n",
      "slots: [0, 1, 1, 2, 2, 3, 3, 4, 4]\n",
      "Steve Zeus\n",
      "slots: [1, 1, 2, 2, 3, 3, 4, 4]\n",
      "Karen Athena\n",
      "slots: [1, 2, 2, 3, 3, 4, 4]\n",
      "Sarah Athena\n",
      "slots: [2, 2, 3, 3, 4, 4]\n",
      "Dave Hercules\n",
      "slots: [2, 3, 3, 4, 4]\n",
      "Jeff Hercules\n",
      "slots: [3, 3, 4, 4]\n",
      "Fred Bacchus\n",
      "slots: [3, 4, 4]\n",
      "Suzie Bacchus\n",
      "slots: [4, 4]\n",
      "Laura Pluto\n",
      "slots: [4]\n",
      "James Pluto\n",
      "slots: []\n"
     ]
    }
   ],
   "source": [
    "printsolution(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import optimization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "24\n",
      "26\n",
      "12\n",
      "15\n",
      "26\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    s=optimization.randomoptimize(domain,dormcost)\n",
    "    print(dormcost(s))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10\n",
      "12\n",
      "10\n",
      "15\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    s=optimization.annealingoptimize(domain,dormcost)\n",
    "    print(dormcost(s))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9\n",
      "9\n",
      "9\n",
      "9\n",
      "12\n",
      "12\n",
      "9\n",
      "9\n",
      "5\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    s=optimization.geneticoptimize(domain,dormcost)\n",
    "    print(dormcost(s))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
